package ldkxingzhe.l365calendar.other;

import android.app.IntentService;
import android.content.Intent;

import ldkxingzhe.l365calendar.utils.LightWakeLock;
import ldkxingzhe.l365calendar.utils.LogUtil;

/**
 * 警告提醒的服务
 */
public class AlertService extends IntentService{
    @SuppressWarnings("unused")
    private static final String TAG = "AlertService";

    public static final String ACTION_TEST_WAKE_LOCK = "action_test_wake_lock";
    /**
     * Creates an IntentService.  Invoked by your subclass's constructor.
     */
    public AlertService(String name) {
        super(name);
    }

    public AlertService(){
        this(TAG);
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        if(ACTION_TEST_WAKE_LOCK.equals(intent.getAction())){
            LogUtil.v(TAG, "action test wake lock");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                LogUtil.e(TAG, e.getMessage());
            }
        }
        LightWakeLock.release(); // 释放设备锁， 部分锁, 最后部分
    }
}
